package com.goods.controller.business;

import com.goods.business.service.inStockService;
import com.goods.common.response.ResponseBean;
import com.goods.common.vo.business.InStockDetailVO;
import com.goods.common.vo.business.InStockVO;
import com.goods.common.vo.system.PageVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * projectName: goods
 *
 * @author: ysc
 * time: 2022/12/4 20:22 周日
 * description:
 */
@RestController
@RequestMapping("/business/inStock")
public class inStockController {

    @Autowired
    private inStockService inStockService;



    //获取入库列表
    @GetMapping("/findInStockList")
    public ResponseBean findInStockList(@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum,
                                        @RequestParam(value = "pageSize")Integer pageSize,
                                        InStockVO inStockVO){
        PageVO<InStockVO> inStockVOPageVO =inStockService.findInStockList(pageNum,pageSize,inStockVO);
        return ResponseBean.success(inStockVOPageVO);
    }

    //入库明细
    @GetMapping("detail/{inStockId}")
    public ResponseBean detail(@PathVariable Long inStockId){
        InStockDetailVO inStockDetailVO =inStockService.detail(inStockId);
        return ResponseBean.success(inStockDetailVO);
    }


    //添加入库信息
    @ApiOperation(value = "添加入库记录")
    @PostMapping("/addIntoStock")
    public ResponseBean addIntoStock(@RequestBody InStockVO inStockVO)throws Exception{
        inStockService.addIntoStock(inStockVO);
        return ResponseBean.success();
    }



//    //入库明细
//        @GetMapping("/detail/{id}")
//        public ResponseBean detail(@PathVariable Long id,
//                                   @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
//                                   @RequestParam(value = "pageSize",defaultValue = "3") Integer pageSize)  {
//            InStockDetailVO detail = inStockService.detail(id,pageNum,pageSize);
//            return ResponseBean.success(detail);
//        }


}
